package demo.db.zookeeper.kafka;

import org.apache.zookeeper.KeeperException;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;

public class KafkaZkDataDemo {
    /** 测试环境XMAN KAFKA ZK 地址 */
    public static final String zk = "192.168.3.65:2181,192.168.3.66:2181,192.168.3.67:2181";

    static Logger logger = LoggerFactory.getLogger(KafkaZkDataDemo.class);

    @Test
    public void listTopic() {
        try (KafkaZookeeperClient client = new KafkaZookeeperClient(zk);) {
            List<String> list = client.listTopics();
            list.stream().forEach(System.out::println);
        } catch (IOException | InterruptedException e) {
            logger.error("", e);
        } catch (KeeperException e) {
            logger.error("", e);
        }

    }
}
